﻿    <UserControl x:Class="VisualWip.Board" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:PresentationModel="clr-namespace:VisualWip.PresentationModel;assembly=PresentationModel" mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="300">

    <ItemsControl x:Name="MyBoard" ItemsSource="{Binding ColumnViewModels}" Background="White">

        <ItemsControl.ItemContainerStyle>
            <Style TargetType="{x:Type FrameworkElement}">
                <EventSetter Event="Loaded" Handler="AttachSizeAndPositionAdorner" />
                <Setter Property="Canvas.Top" Value="{Binding PositionY}" />
                <Setter Property="Canvas.Left" Value="{Binding PositionX}" />
                <Setter Property="Height" Value="{Binding Height}" />
                <Setter Property="Width" Value="{Binding Width}" />
                <Setter Property="Panel.ZIndex" Value="{Binding ZIndex}" />
            </Style>
        </ItemsControl.ItemContainerStyle>
        <ItemsControl.ItemsPanel>
            <ItemsPanelTemplate >
                <ZoomableCanvas    
                                    Loaded="ZoomableCanvasLoaded"
                                    RealizationLimit="1000"
                                    RealizationRate="10"
                                    RealizationPriority="Background"
                                    Scale="{Binding Scale, Mode=OneWay}"
                                    />
            </ItemsPanelTemplate>
        </ItemsControl.ItemsPanel>
    </ItemsControl>
</UserControl>